package model

import "github.com/gogf/gf/v2/util/gmeta"

type UserIdReq struct {
	Id string `json:"id"  dc:"用户id"    v:"required#用户id必填"`
}

type UserIdRes struct {
	Id string `json:"id"  dc:"用户id"`
}
type UserInfoIdReq struct {
	Id string `json:"id"  dc:"用户详情id"    v:"required#用户详情id必填"`
}

type UserInfoIdRes struct {
	Id string `json:"id"  dc:"用户详情id"`
}

// UserLoginStruct 用户登录入参
type UserLoginStruct struct {
	Type      int    `json:"type"   v:"bail|required|in:1,2,3#|请选择登录类型|type错误,1密码登录,2手机登录,3微信登录"    dc:"1密码登录,2手机登录,3微信登录"`
	Username  string `json:"username"   v:"required-if:type,1#请输入用户名称" dc:"用户名称"`
	Phone     string `json:"phone"   v:"bail|required-if:type,2|phone#|请填写手机号|手机号不正确" dc:"手机号码"`
	PhoneCode string `json:"phoneCode"   v:"required-if:type,2#请填写手机验证码" dc:"手机验证码"`
	Password  string `json:"password"   v:"bail|required-if:type,1|password2#|账户登录请填写密码|密码必须包含大小写字母和数字" dc:"用户密码"`
}

type LotUserDBRes struct {
	gmeta.Meta `orm:"table:lot_user"`
	Id         string `json:"id"       dc:"用户表的主键id" `
	Username   string `json:"username"   dc:"用户名称"`
	Phone      string `json:"phone"      dc:"用户手机号"`
	HeadImg    string `json:"headImg"   dc:"用户头像" `
	Sex        int    `json:"sex"      dc:"性别 0 未知 1 男  2 女"  `
	WxOpenid   string `json:"wxOpenid"      dc:"微信openid"  `
}

type UserInfoDetails struct {
	gmeta.Meta             `orm:"table:lot_user_info"`
	IdCard                 string  `json:"idCard" dc:"用户的身份证号"`
	UserId                 string  `json:"userId"  dc:"用户的id"`
	Birthday               string  `json:"birthday" dc:"出生日期"`
	Email                  string  `json:"email" dc:"用户邮箱"`
	Address                string  `json:"address"  dc:"详情地址"`
	Longitude              int     `json:"longitude"  dc:"所在的经度"`
	Latitude               int     `json:"latitude"   dc:"所在的纬度"`
	ActualRecharge         float64 `json:"actualRecharge"  dc:"实际充值的金额"`
	GiveRecharge           float64 `json:"giveRecharge"  dc:"赠送充值的金额"`
	CumulativeChargingTime int     `json:"cumulativeChargingTime" dc:"累计充电时长(秒)"`
	ExchangeChargingTime   int     `json:"exchangeChargingTime" dc:"兑换充电时长(秒)"`
	Country                string  `json:"country" dc:"国家"`
	Province               string  `json:"province" dc:"省份"`
	City                   string  `json:"city"  dc:"城市"`
}

// EditUserInfo 编辑用户
type EditUserInfo struct {
	IdCard    string  `json:"idCard" dc:"用户的身份证号"`
	Birthday  string  `json:"birthday" dc:"出生日期" v:"datetime#出生日期格式不正确"`
	Email     string  `json:"email" dc:"用户邮箱" v:"email#邮箱格式不正确"`
	Address   string  `json:"address"  dc:"详情地址"`
	Username  string  `json:"username"   dc:"用户名称" v:"required#用户名称必填"`
	HeadImg   string  `json:"headImg"   dc:"用户头像"  v:"url#头像不是一个正确的地址"`
	Sex       int     `json:"sex"      dc:"性别  1 男  2 女"  v:"in:0,1,2#性别只能按照枚举填写"`
	WxOpenid  string  `json:"wxOpenid"      dc:"微信openid" v:"required#微信openid必填"`
	Longitude float64 `json:"longitude"  dc:"所在的经度"  v:"float#经度不是一个正确的浮点数"`
	Latitude  float64 `json:"latitude"   dc:"所在的纬度" v:"float#纬度不是一个正确的浮点数"`
}

type UserInfoAndInfoRes struct {
	UserInfoIdReq
	UserInfoDetails
}

type UserInfoRes struct {
	LotUserDBRes
	CreatedAt       string           `json:"createdAt" dc:"创建时间" `
	UserInfoDetails *UserInfoDetails `json:"userInfo" dc:"用户详情"  orm:"with:user_id=id"`
}

type UserListRes struct {
	List []*UserInfoRes `json:"list" dc:"用户列表"`
	*PutPage
}

// GiftAmount 赠送用户金额
type GiftAmount struct {
	UserIdReq
	GiveRecharge float64 `json:"giveRecharge"  dc:"赠送充值的金额"`
}
